package cn.neusoft.yuejian307.Fragment.insidefragment;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import java.util.List;

import cn.neusoft.yuejian307.R;
import cn.neusoft.yuejian307.adapter.MasterAdapter;
import cn.neusoft.yuejian307.bean.Coach;
import cn.neusoft.yuejian307.listener.UserListener;
import cn.neusoft.yuejian307.model.UserModel;


public class FragmentMaster extends Fragment implements UserListener<Coach>{
    private RecyclerView  recyclerView_master;
    private View view;
    @Override
    public View onCreateView(LayoutInflater inflater , ViewGroup container , Bundle savedInstanceState)
    {
        view = inflater.inflate(R.layout.fragment_master, null) ;
        recyclerView_master = (RecyclerView)view.findViewById(R.id.recyclerView_master);
        recyclerView_master.setLayoutManager(new LinearLayoutManager(getActivity()));
        masterlist();
        return view ;
    }

    private void masterlist(){
        UserModel userModel = new UserModel();
        userModel.coachData(this,1);
    }

    @Override
    public void onResponse(Coach coach) {
        List<Coach.ClubcoachlistBean> clubcoachlistBeen = coach.getClubcoachlist();
        MasterAdapter adapter = new MasterAdapter(getActivity(),clubcoachlistBeen);
        recyclerView_master.setAdapter(adapter);
    }

    @Override
    public void onFail(String msg) {

    }
}
